﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using System.Web.Script.Serialization;
using Axis.BusinessObject.Research;
using Axis.BusinessObject.Core;
using PhuLeBooze.Views.Project.Class;


namespace PhuLeBooze.Views.Project.Service
{
    /// <summary>
    /// Summary description for ResponseOptionService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    [System.Web.Script.Services.ScriptService]
    public class ManagerQuestionService : System.Web.Services.WebService
    {
        [WebMethod(EnableSession=true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetQuestionList(int ProjectID)
        {
            CQuestionUI UI = new CQuestionUI();
            var Map = UI.GetQuestionareList(ProjectID);
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(Map);
            return strJSON;
        }
        // CResearchDao core = new CResearchDao();
        [WebMethod(EnableSession=true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetPathDetailList(int ProjectID, int PathID)
        {
            IList<CQuestionPathDetail> listPath = (new CQuestionPathUI()).GetQuestionPathDetailList(PathID, ProjectID);
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(listPath);
            return strJSON;
        }

        [WebMethod (EnableSession=true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string ActionQuestionnaireConditions(string InputValue)
        {
            CApplicationMessage listPath = (new CQuestionPathUI()).ActionQuestionnaireConditions(InputValue);
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(listPath);
            return strJSON;
        }


        [WebMethod (EnableSession=true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string GetQuestionnaireConditionsDetails(int ProjectID, int PathID)
        {
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize((new CQuestionPathUI()).GetQuestionnaireConditionsDetails(ProjectID, PathID));
            return strJSON;
        }
        [WebMethod(EnableSession = true)]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string ChangeStatus(int ProjectID, int Status)
        {
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize((new CProjectUI()).ActionChangeStatus(ProjectID, Status));
            return strJSON;
        }
    }
}
//